import service from ".";
import { ToSaveArticle } from "../type";


//下载图片
export function uploadPic(richPic: File) {
    return service({
        url: "/rich-text/uploadAPicFile",
        method: "post",
        data:{
            richPic
        },
        headers:{
            'Content-Type': 'multipart/form-data'
        }
    })
}
//下载video
export function uploadVideo(richVideo: File) {
    return service({
        url: "/rich-text/uploadAVideoFile",
        method: "post",
        data:{
            richVideo
        },
        headers:{
            'Content-Type': 'multipart/form-data'
        }
    })
}
//删除文件数组
export function deleteFile(data: Array<String>) {
    return service({
        url: "/rich-text/deleteAFile",
        method: "post",
        data
    })
}
//保存文章
export function toSaveArticleAndFile(article:ToSaveArticle){
    return service({
     url:"/article/toSaveArticle",
     method:"POST",
     data:{
        articleAuthor:article.articleAuthor,
        articleContent:article.articleContent,
        articleFileUrl:article.articleFileUrl,
        articleName:article.articleName
     }
    })
}
//查询文章
export function toQueryArticleApi(IArticleId:bigint){
    return service({
        url:"/article/toQueryArticle",
        method:"GET",
        params:{
            //文章id
            articleId:IArticleId
        }
    })
}
